function [t,x] = portableODESolver(ode, t, x0)
% detect: MATLAB (v 7.x) or Octave (v 3.x)
% since they use different ODE solvers

s = version;
if s(1) == '7'
	fprintf('MATLAB %s detected. Using ode45().\n', s);
	options = odeset('RelTol', 1e-10, 'AbsTol', 1e-10*ones(size(x0)));
	[t, x] = ode45(ode, [min(t) max(t)], x0, options);

elseif s(1) == '3'
	fprintf('Octave %s detected. Using lsode().\n', s);
	% TODO lsode options
	x = lsode(ode, x0, t);

else
	fprintf('ERROR! Environment not recognized!\n');
	x = -1;

end

return
